package org.piera.diables;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

public class HelloListView extends ListActivity  {
	/** Called when the activity is first created. */
	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		
		// Create an array of Strings, that will be put to our ListActivity
		String[] actes = new String[] { "Correfoc Infantil", "Correfoc", "Festa Major", "Festa perque si",
				"Carnaval", "Carnaval do Verao", "Android", "iPhone" };
		// Use your own layout and point the adapter to the UI elements which
		// contains the label
		this.setListAdapter(new ArrayAdapter<String>(this, R.layout.rowlayout,
				R.id.label, actes));
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {
		super.onListItemClick(l, v, position, id);
		// Get the item that was clicked
		Object o = this.getListAdapter().getItem(position);		
		String[] Info = new String[] {"Lloc: Vila de Piera\nHora: 18:00\nOrganitza: Colla Infantil","Lloc: Vila de Piera\nHora: 18:00\nOrganitza: Diables de Piera"};
		String keyword = o.toString();
		if (position < 2) {
			Toast.makeText(this, Info[position], Toast.LENGTH_LONG).show();
		}
	}

}